'use strict';

const { Service } = require('egg');
class NeedHelpService extends Service {
  // 添加求助信息
  async createHelp (info) {
    const { ctx, app } = this;
    try {
      const result = await app.mysql.insert('needDrug', info); // 给list表新增一条数据
      return result;
    } catch (error) {
      console.log(error);
      return null;
    }
  }
  // 编辑求助信息
  //service/home.js
  async editHelp (id, isEamine) {
    const { ctx, app } = this;
    try {
      const result = await app.mysql.update('needDrug', { isEamine }, {
        where: {
          id
        }
      });
      return result;
    } catch (error) {
      console.log(error);
      return null;
    }
  }
}
module.exports = NeedHelpService;
